﻿using LuaInterface;
using UnityEngine;

public class CRayEffect : MonoBehaviour
{
	[NoToLua]
	public Transform ray;
	[NoToLua]
	public float scaleFactor = 1;
	[NoToLua]
	public Vector3 startPos;
	[NoToLua]
	public Vector3 endPos; 

	public void Set(float startX,float startY,float startZ,float endX,float endY,float endZ)
	{
		
		startPos.Set(startX, startY, startZ);
		endPos.Set(endX, endY, endZ);
		var dir = endPos - startPos;
		ray.right = -dir;
		ray.localScale = new Vector3(dir.magnitude* scaleFactor, 1,1);
		transform.position = startPos;
	}
}
